package cgb2202.recruitment01.mapper;

import cgb2202.recruitment01.entity.ComJob;
import cgb2202.recruitment01.entity.Emp;
import cgb2202.recruitment01.entity.JobBriefInfoTDO;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface EmpMapper {
    @Select("SELECT * FROM users WHERE email = #{email}")
    public Emp getEmpsByEmail(String email);

    @Select("SELECT * FROM users")
    public List<Emp> getUserList();

    @Select("SELECT * FROM users WHERE email=#{email}")
    public List<Emp> getUserListByEmail(String email);

    @Insert("insert into users values(null,#{email}, #{password})")
    public void add(Emp emp);

    @Update("UPDATE users SET password = #{user.password}  WHERE email = #{email}")
    public int update(String email, Emp emp);

    @Delete("DELETE from users where email = #{email} ")
    public int delete(String email);

    @Select("select id from users where users.email=#{email}")
    public Object getPara(String para, String email);

    @Update("update users set password=#{password} where id=#{id}")
    public boolean rePassword(int id, String password);

    @Select("select r.id,job,annual_salary,name,education,r.location from recruit_info r , company_info c where r.cid= c.id  ")
    List<JobBriefInfoTDO> selectAllJob();

    @Select("select * from recruit_info where id=#{id}  ")
    ComJob selectJobById(int id);
}